<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="../common.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>监控项表单</title>
</head>
<body>
<form id="ff" action="${ctx}/monitorItem/upd" method="post" data-options="novalidate:true">
	<input type="hidden" id="id" name="id" value="${monitorItem.id}">
	<input type="hidden" id="alarm" name="alarm" value="${monitorItem.alarm}">
	<input type="hidden" id="enable" name="enable" value="${monitorItem.enable}">
	<input type="hidden" id="message" value="${message}">
	<div style="margin-bottom:15px">
		<input type="hidden" id="systemId_hid" value="${monitorItem.systemId}" >
		<select class="easyui-combobox" id="systemId" name="systemId" label="所属系统:" style="width:35%">
			<c:forEach items="${systemList}" var="system" varStatus="status">
				<option value="${system.id}">${system.name}</option>
			</c:forEach>
		</select>
	</div>
	<div style="margin-bottom:15px">
		<input class="easyui-textbox" name="name" value="${monitorItem.name}" style="width:95%" data-options="label:'监控名称:',required:true">
	</div>
	<div style="margin-bottom:15px">
		<input class="easyui-textbox" name="describe" value="${monitorItem.describe}" style="width:95%" data-options="label:'描述:'">
	</div>
	<div style="margin-bottom:15px">
		<input class="easyui-textbox" name="monitorScript" value="${monitorItem.monitorScript}" style="width:95%;height:100px" data-options="label:'监控脚本:',required:true,multiline:true">
	</div>
	<div style="margin-bottom:15px">
		<input type="hidden" id="thresholdType_hid" value="${monitorItem.thresholdType}" >
		<select class="easyui-combobox" id="thresholdType" name="thresholdType" label="阈值类型:" style="width:35%">
			<option value="0">大于</option>
			<option value="1">小于</option>
			<option value="2">大于等于</option>
			<option value="3">小于等于</option>
		</select>
	</div>
	<div style="margin-bottom:15px">
		<input class="easyui-textbox" name="threshold" value="${monitorItem.threshold}" style="width:95%" data-options="label:'阈值:',required:true">
	</div>
	<div style="margin-bottom:15px">
		<input class="easyui-textbox" name="executeMinute" value="${monitorItem.executeMinute}" style="width:95%" data-options="label:'执行频率:',required:true">
	</div>
	<div style="margin-bottom:15px">
		<input class="easyui-textbox" name="dataScript" value="${monitorItem.dataScript}" style="width:95%;height:100px" data-options="label:'检查数据脚本:',multiline:true">
	</div>
</form>
<div style="text-align:center;padding:5px 0">
	<a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()" style="width:80px">Submit</a>
	<a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()" style="width:80px">Clear</a>
</div>
</body>
<script>
	$(function() { 
		// 初始化数据
		var systemId_hid = $("#systemId_hid").val();
		if(systemId_hid){
			$('#ff').form('load',{
				systemId:systemId_hid
			});
		}
		var thresholdType_hid = $("#thresholdType_hid").val();
		if(thresholdType_hid >= 0){
			$('#ff').form('load',{
				thresholdType:thresholdType_hid
			});
		}
		// 消息提醒
		var message = $("#message").val();
		if(message){
			$.messager.alert('提示', message);
			parent.reloadList();
		}
	});
	function submitForm(){
		//数据检查
		if(!$('#ff').form('enableValidation').form('validate')){
			return;
		}
		//提交
		$('#ff').submit();
	}
	function clearForm(){
		$('#ff').form('clear');
	}
</script>
</html>